package com.tjrac.zhaopin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tjrac.zhaopin.bean.EnterpriseInfoWithUsername;
import com.tjrac.zhaopin.entity.EnterpriseInfo;
import com.tjrac.zhaopin.entity.HunterInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface EnterpriseInfoMapper extends BaseMapper<EnterpriseInfo> {
    @Select("SELECT " +
            "enterprise_info.ent_name AS entName," +
            "enterprise_info.region," +
            "enterprise_info.information," +
            "enterprise_info.verified," +
            "enterprise_info.holder_id AS userId," +
            "sys_user.username FROM enterprise_info INNER JOIN sys_user ON enterprise_info.holder_id=sys_user.id")
    List<EnterpriseInfoWithUsername> listEnterpriseInfoWithUsername();

    @Select("SELECT " +
            "hunter_info.* " +
            "FROM " +
            "hunter_info " +
            "INNER JOIN post_info ON post_info.hunter_id = hunter_info.hunter_id " +
            "WHERE " +
            "post_info.job_id = #{jobId, jdbcType=INTEGER} AND post_info.status= 0 ")
    List<HunterInfo> listHunterInfoByJobId(@Param("jobId") Integer jobId);
}
